﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Oracle.DataAccess.Client;
using System.Diagnostics;
using System.Data;
using Titan.Test.Entity;

namespace Titan.Test
{
    [TestClass]
    public class PerformanceTest
    {
        [TestMethod]
        public void InsertTest()
        {

            //OracleConnection cn = new OracleConnection(Environment.ConnectionString);
            //cn.Open();

            //IDbSession se= Environment.OpenSession();

            //int testCount = 1000;
            //long lcn=0;
            //long lse=0;
            //Stopwatch st = new Stopwatch();

            
            //st.Start();
            //for (int i = 0; i < testCount; i++)
            //{
            //    OracleCommand cmd = new OracleCommand();
            //    cmd.CommandText = "begin insert into Test_Area (areaid,areaName,parentAreaId) values (test_areaid.nextval,:v1,:v2);select test_areaid.currval into :v3 from dual;end;";
            //    cmd.Parameters.Add("v1", OracleDbType.Varchar2).Value = Guid.NewGuid().ToString();
            //    cmd.Parameters.Add("v2", OracleDbType.Int32).Value = 9;
            //    cmd.Parameters.Add("v3", OracleDbType.Int32, ParameterDirection.Output).Value = 9;
            //    cmd.Connection = cn;
            //    cmd.ExecuteNonQuery();
            //}
            //st.Stop();
            //lcn = st.ElapsedMilliseconds;

            //st = new Stopwatch();
            //st.Start();
            //for (int i = 0; i < testCount; i++)
            //{
            //    Area obj = new Area();
            //    obj.AreaName = Guid.NewGuid().ToString();
            //    obj.ParentAreaId = 9;
            //    se.Insert(Environment.TableMapping, obj);
            //}
            //st.Stop();
            //lse = st.ElapsedMilliseconds;

            //cn.Close();
            //se.Close();
        }
    }
}
